//排列组合
#include <iostream>

using namespace std;

void show(char* in,int len){
    for(int i=0;i<=len;i++){
        cout<<in[i];
    }
    cout<<endl;
}

void permutation(char *in,const int left,const int right){
    if(left==right){
        show(in,right);
    } else{
        for(int i=left;i<=right;i++){
            //show(in,right);
            cout<<"i:"<<i<<",in["<<i<<"]:"<<in[i]<<",left:"<<left<<endl;
            swap(in[left],in[i]);
            //show(in,right);
            permutation(in,left+1,right);
            //show(in,right);
            swap(in[left],in[i]);
            //show(in,right);
        }
    }
}

int main(){
    char in[]="abc";
    permutation(in,0,2);
    system("pause");
    return 0;
}